import mongoose from 'mongoose'
// 数据库地址
const DB_URL = '[mongodb地址]'
// 连接数据库
mongoose.connect(DB_URL, { useNewUrlParser: true })
const db = mongoose.connection

db.on('error', console.error.bind(console, 'connection error:'))
db.once('open', function() {
  console.log('数据库连接成功！')
})

export default mongoose